<?php
/**
 * @author Eugenio Fage
 * http://eugeniofage.wordpress.com/
 * http://code.google.com/p/monky/
 * 
 */
class Blog extends AppModel {
		
	var $hasMany = array(
		'Link'
	);
	
	var $validate=array(
		'key'=>array(
			'rule'=>'isunique'
		)
	);
	
		            
    function getBlogData(Page $pageObj){
    	if($id=$this->field('id',array('key'=>$pageObj->blog['key']))){
    		return $id;
    	}
    	    	
		
    }  
    
    function saveBlog(Page $pageObj){

    	if(!$this->hasAny(array('key'=>$pageObj->blog['key']))){
    		$this->create($pageObj->blog);
			$this->save();	
    	}
    }
	
}
?>